package com.weiz.designpatterns.memento;

import java.util.Stack;

public class TextEditorCaretaker {
    private Stack<TextEditorMemento> mementos = new Stack<>();
    public void saveMemento(TextEditorMemento memento) {
        mementos.push(memento);
    }
    public TextEditorMemento getMemento() {
        if (!mementos.isEmpty()) {
            return mementos.pop();
        }
        return null;
    }
}
